package ${_packageName};

import com.evacipated.cardcrawl.modthespire.lib.SpireInitializer;
<#if (_usedSubscribers?size > 0)>
import basemod.interfaces.*;
import basemod.BaseMod;
</#if>

import com.megacrit.cardcrawl.core.Settings;
<#if (usedSubscribers?contains("EditStringsSubscriber"))>
import com.megacrit.cardcrawl.localization.*;
</#if>

import com.badlogic.gdx.Gdx;

@SpireInitializer
public class ${_modId} <#if (usedSubscribers?size > 0)>implements</#if>
    <#list usedSubscribers as sub>
    ${sub}<#if (sub_has_next)>,</#if>
    </#list> {

    public ${_modId}() {
        <#if (usedSubscribers?size > 0)>BaseMod.subscribe(this);</#if>
    }

    public static String makeID(String name) {
        return "${_modId}:" + name;
    }

    public static String getResourcePath(String path) {
        return "${_imageResourcePath}/" + path;
    }

    public static void initialize() {
        new ${_modId}();
    }

    public static String getLanguageStrings() {
        switch (Settings.language) {
            <#list _languages as lan>
            case ${lan?upper_case}:
                return "${lan?lower_case}";
            </#list>
        }
        return "eng";
    }
    <#if (usedSubscribers?contains("EditStringsSubscriber"))>

    @Override
    public void receiveEditStrings() {
        String lan = getLanguageStrings();

        <#if (usedSubscribers?contains("EditCharactersSubscriber"))>
        String characterStrings = Gdx.files.internal("${_localizationPath}/" + lan + "/${_modId}-CharacterStrings.json").readString("UTF-8");
        BaseMod.loadCustomStrings(CharacterStrings.class, characterStrings);
        </#if>
        <#if (usedSubscribers?contains("EditCardsSubscriber"))>
        String cardStrings = Gdx.files.internal("${_localizationPath}/" + lan + "/${_modId}-CardStrings.json").readString("UTF-8");
        BaseMod.loadCustomStrings(CardStrings.class, cardStrings);
        </#if>
        <#if (usedSubscribers?contains("EditRelicsSubscriber"))>
        String relicStrings = Gdx.files.internal("${_localizationPath}/" + lan + "/${_modId}-RelicStrings.json").readString("UTF-8");
        BaseMod.loadCustomStrings(RelicStrings.class, relicStrings);
        </#if>
        <#if (addMonsters)>
        String monsterStrings = Gdx.files.internal("${_localizationPath}/" + lan + "/${_modId}-MonsterStrings.json").readString("UTF-8");
        BaseMod.loadCustomStrings(MonsterStrings.class, monsterStrings);
        </#if>
        <#if (addEvents)>
        String eventStrings = Gdx.files.internal("${_localizationPath}/" + lan + "/${_modId}-EventStrings.json").readString("UTF-8");
        BaseMod.loadCustomStrings(EventStrings.class, eventStrings);
        </#if>
        <#if (addPotions)>
        String potionStrings = Gdx.files.internal("${_localizationPath}/" + lan + "/${_modId}-PotionStrings.json").readString("UTF-8");
        BaseMod.loadCustomStrings(PotionStrings.class, potionStrings);
        </#if>
    }
    </#if>
    <#if (usedSubscribers?contains("EditKeywordsSubscriber"))>

    @Override
    public void receiveEditKeywords() {
        String lan = getLanguageStrings();
        //TODO
    }
    </#if>
}